<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
    <head>
    
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>现金流水表</title>
	<meta name="renderer" content="webkit">	
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">	
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">	
	<meta name="apple-mobile-web-app-status-bar-style" content="black">	
	<meta name="apple-mobile-web-app-capable" content="yes">	
	<meta name="format-detection" content="telephone=no">	
	<link rel="stylesheet" type="text/css" href="/bsc/static/common/layui/css/layui.css" media="all">
	<link rel="stylesheet" type="text/css" href="/bsc/static/common/bootstrap/css/bootstrap.css" media="all">
	<link rel="stylesheet" type="text/css" href="/bsc/static/common/global.css" media="all">
	<link rel="stylesheet" type="text/css" href="/bsc/static/css/personal.css" media="all">
</head>
<body>
<section class="layui-larry-box">

	<form class="form-inline" role="form" action="" method="post">
	 <input type="hidden" id="shopid" >
            <blockquote class="layui-elem-quote news_search">
  <div class="form-group">
      订单编号:
    <input type="text" class="form-control" name="order_id" id="order_id" placeholder="请输入订单编号"  value="${map.order_id }">
  </div>
   <div class="form-group">
      顾客帐户:
    <input type="text" class="form-control" name="mobile" id="mobile" placeholder="请输入顾客帐户" value="${map.mobile }">
  </div>
   支付方式:
  <select class="form-control" name="pay_way" id="pay_way">
  <option value="-1">请选择</option>
  <option value="1">微信</option>
  <option value="2">支付宝</option>
</select> <br>
    分类:
  <select class="form-control" name="record_type" id="record_type">
  <option value="-1">请选择</option>
  <option value="1">购买颜值</option>
  <option value="2">购买套餐</option>
  <option value="3">使用消费</option>
  <option value="4">预约</option>
 </select> 
 <div class="form-group">
      支付时间:
    <input type="date" class="form-control" name="ptime"  value="${map.ptime }" id="ptime" >
  </div>
   <div class="form-group">
      至:
    <input type="date" class="form-control" name="ntime"  value="${map.ntime }" id="ntime">
  </div>
  <button type="button"   class="btn btn-primary" onclick="cx()">查询</button>
  <div class="layui-inline">
   <button id="export" type="button" class="btn btn-primary"><span class="glyphicon glyphicon-pencil"></span>导出Excel</button>
  <button type="button"  class="btn btn-primary" onclick="cz()">重置</button>
</div>
   
  
  
  
	</blockquote>
            
		         <!-- 操作日志 -->
                <div class="layui-form news_list">
                    <table class="layui-table" id="tab">
					    <colgroup>
						<col width="9%">
						<col width="9%">
						<col width="9%">
						<col width="9%">
						<col width="9%">
						<col width="9%">
						<col width="9%">
						<col width="15%">
					</colgroup>
					<thead>
						<tr >
							<td style="text-align:left;">编号</td>
							<td>流水号</td>
							<td>订单编号</td>
							<td>顾客帐户</td>
							<td>姓名</td>
							<td>颜值数量</td>
							<td>支付方式</td>
							<td>实际消费金额</td>
							<td>分类</td>
							<td>支付时间</td>
						</tr>
					</thead>
					<tbody class="news_content"  id="tb">
						<c:forEach items="${info.list }" var="re" varStatus="s">
						<tr >
							<td align="left">${s.index+1 }</td>
 							<td>${re.record_id }</td> 
							<td>${re.order_id }</td>
							<td>${re.custom_user.mobile }</td>
							<td>${re.custom_user.username }</td>
							<td>${re.beauty_num }</td>
							<td>
							<c:if test="${re.pay_way=='1' }">微信</c:if>
							<c:if test="${re.pay_way=='2' }">支付宝</c:if>
							</td>
							<td>${re.money }</td>
							<td>
							<c:if test="${re.record_type=='1' }">购买颜值</c:if>
							<c:if test="${re.record_type=='2' }">购买套餐</c:if>
							<c:if test="${re.record_type=='3' }">使用消费</c:if>
							<c:if test="${re.record_type=='4' }">预约</c:if>
							</td>
							<td>
							 <fmt:formatDate value="${re.pay_time }" pattern="yyyy-MM-dd"/>
							</td>
						</tr>
						</c:forEach>
					</tbody>
					</table>
                     
		</div>
		<div class="layui-inline">
  <a href="#" class="layui-btn layui-btn-normal" onclick="up()">上一页</a>   <a class="layui-btn layui-btn-normal" href="#" onclick="next()" >下一页</a>
</div>
		
	  </form> 
	

</section>
<script type="text/javascript" src="/bsc/static/common/layui/layui.js"></script>
<!-- <script type="text/javascript" src="../static/js/newslist.js"></script> -->
 <script type="text/javascript" src="/bsc/static/js/jquery.min.js"></script> 
<script type="text/javascript" src="/bsc/static/common/bootstrap/js/bootstrap-3.3.7-dist/js/bootstrap.js"></script>
<script type="text/javascript">
$(function(){
	 $('#export').click(function(){
			var trNum=$("#tab").find("tr").length ;//获取表格行数
			var tdNum=$("#tab").find("tr:eq(0)").find("td").length;//获取表格列数
			var arr="";
			for(i=0;i<trNum;i++){
				var str="";
				for(j=0;j<tdNum;j++){
					var info=$("#tab tr:eq("+i+") td:eq("+j+")").text();
					str=str+info+",";
				}
				str=str.substring(0,str.length-1);
				arr=arr+str+"%26";
			}
			window.location.href="/bsc/finance/export?arr="+arr;
	});
	  //下拉框定值
	 $("#pay_way").val(${map.pay_way});
	 $("#record_type").val(${map.record_type});
});
//日期判断
$("#ptime").change(function(){
	   var date=new Date($("#ptime").val());
	  if( date>new Date()){
		  alert("日期选择错误")
			$("#ptime").val(0);
	  }
  });
$("#ntime").change(function(){
	   var date=new Date($("#ptime").val());
	   var date2=new Date($("#ntime").val());
	   if($("#ptime").val()==""){
         alert("前面日期必须选择")	
         $("#ntime").val(0);
	   }else{
		   if( date2>new Date() || date2<date){
				  alert("日期选择错误")
					$("#ntime").val(0);
			  } 
	   }
});
//查询
function cx(){
	document.forms[0].action="/bsc/cashrecord/listAll";
	document.forms[0].submit();
};
 	
//上一页
function up(){
	document.forms[0].action="/bsc/cashrecord/listAll?page="+${info.prePage};
	document.forms[0].submit();
};
//下一页
function next(){
	document.forms[0].action="/bsc/cashrecord/listAll?page="+${info.nextPage};
	document.forms[0].submit();
};
//导出
function ex(){
	document.forms[0].action="/bsc/excel/export.do";
	document.forms[0].submit();
}
//重置
 function cz(){
	$("#order_id").val("");
	$("#mobile").val("");
	$("#record_type").val("-1");
	$("#pay_way").val("-1");
	$("#ptime").val("");
	$("#ntime").val("");
} 
</script>
</body>
</html>